package com.zuora.interview.topn.bean;

/**
 * Created by chunyang.gao on 2016/8/24.
 */
public class ThreePagePathResult implements Comparable<ThreePagePathResult>{

    String path;

    int count;

    public ThreePagePathResult() {
    }

    public ThreePagePathResult(String path) {
        this.path=path;
    }

    public ThreePagePathResult(String path, int count) {
        this.path = path;
        this.count = count;
    }

    @Override
    public int compareTo(ThreePagePathResult o) {
        if(o.count>this.count){
            return 1;
        }else if(o.count<this.count){
            return -1;
        }
        return 0;
    }

    public String getPath() {
        return path;
    }

    public int getCount() {
        return count;
    }

    public synchronized void incr(int count){
        this.count+=count;
    }


    @Override
    public String toString() {
        return "ThreePagePathResult{" +
                "path='" + path + '\'' +
                ", count=" + count +
                '}';
    }
}
